	
	<div id="page-content">
			<div class="col-lg-12">
		        <div class="panel">
		            <div class="panel-heading">
		                <h3 class="panel-title" style="text-align: right;">
		                	#@installPJaxGoBackBtn()
		                	公文起草
		                	#@installFlowHisBtn(defId,procInsId)
		                	#@installAttachment(o?o.id:'')
		                	#if(o.id)
			                	<a href="#(ctx)/admin/oa/bumph/export?id=#(o.id)" target="_blank">
			                		<button class="btn btn-warning" type="button">导出</button>
			                	</a>
		                	#end
		                </h3>
		                
		            </div>
		            #include("editForm.html")

		        </div>
		    </div>
	</div>
	<script>
		function save(){
			var data = common_ajax.ajaxFunc("/admin/oa/bumph/draftSave", $('#editForm').serialize(), "json", null);
			if(data.success){
				pointLion.alertMsg("保存成功!" , "success" , "small" , function(){
					location.href = ctx+'/admin/oa/bumph/getDraftListPage';//跳转到列表页
				},data);
			}else{
				pointLion.alertMsg(data.message , "success" , "small" , function(){
					$(".btn").removeAttr("disabled");
				},data);
			}
		}
		//选择主送单位
		function selectFirst(){
			pointLion.selectManyOrg(function(orgNode){
				var firstId = [];
				var firstName = [];
				$.each(orgNode,function(i,d){
					firstId.push(d.id);
					firstName.push(d.name);
				});
				$("#firstOrgId").val(firstId.join(","));
				$("#firstOrgName").val(firstName.join(","));
				//重新校验
				$("#editForm").data('bootstrapValidator').destroy();
		        $('#editForm').data('bootstrapValidator', null);
		        formValidate();
			});
		}
		//选择抄送单位
		function selectSecond(){
			pointLion.selectManyOrg(function(orgNode){
				var firstId = [];
				var firstName = [];
				$.each(orgNode,function(i,d){
					firstId.push(d.id);
					firstName.push(d.name);
				});
				$("#secondOrgId").val(firstId.join(","));
				$("#secondOrgName").val(firstName.join(","));
				
			});
		}
		//表单校验
		function formValidate(){
			$('#editForm').bootstrapValidator({
	    		excluded:[":disabled"],
	            fields: {
	            	"#(formModelName).doc_num_n": {
	                    validators: {
	                        notEmpty: {
	                            message: '*公文文号不能为空'
	                        },
	                        lessThan: {
	        					inclusive:true,
	        					value: 99999999,
	        					message: '*请输入小于99999999的数字'
	        				}
	                    }
	                },
	            	"#(formModelName).title": {
	                    validators: {
	                        notEmpty: {
	                            message: '*公文标题不能为空'
	                        },
	                        stringLength: {
	                            max: 25,
	                            message: '*公文标题长度必须小于25'
	                        }
	                    }
	                },
	                "firstOrgId": {
	                    validators: {
	                    	notEmpty: {
	                            message: '*主送单位不能为空'
	                        }
	                    }
	                },
	                "#(formModelName).content": {
	                    validators: {
	                    	notEmpty: {
	                            message: '*公文描述内容不能为空'
	                        }
	                    }
	                }
	            }
	        }).on("success.form.bv", function (e) {
	            save();
	            return false;//阻止表单跳转
	        });
		}
		$(document).ready(function() {
			$(".selectpicker").selectpicker({});
			$(".bootstrap-select").attr("style","width:100%;");
			formValidate();
		});
	</script>